<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<link rel="stylesheet" type="text/css" href="__THEMES__/style/common.css" />
       	<link rel="stylesheet" type="text/css" href="__THEMES__/style/admin_ui.css" />
       	<link rel="stylesheet" href="__PUBLIC__/editor/themes/default/default.css" />
       	
       	<script type="text/javascript" src="__JS__/jQuery/jquery.js"></script>
       	<script type="text/javascript" src="__JS__/jQuery/plugin/formstyle.js"></script>
        <script type="text/javascript" src="__JS__/jQuery/plugin/artDialog/jquery.artDialog.js?skin=aero"></script>
        <script type="text/javascript" src="__JS__/jQuery/plugin/artDialog/plugins/iframeTools.js"></script>
        
		<script charset='utf-8' src='__PUBLIC__/editor/kindeditor.js'></script>
        <script charset='utf-8' src='__PUBLIC__/editor/lang/zh_CN.js'></script>
        
        <include file="Public:js_navigation" />
        <include file="Public:js_sidebar" />
        
        <script type="text/javascript">
        	
        	var editor;
			KindEditor.ready(function(K){
				editor = K.create("#content",{
					uploadJson:'__APP__/uploadfile/uploadeditor',
					allowFileManager:true,
					width : "100%",
					fileManagerJson:'__APP__/filemanage/viewlist',
					afterUpload:function(data){
						if($("#content_attachment").val() == ""){
			       			$("#content_attachment").attr("value",data);
			       		}else{
			       			$("#content_attachment").attr("value",$("#content_attachment").val()+"|"+data);
			       		}
					}
				});
			});
        	
            $(function(){
                
				$('#newupthumb').click(function(){
					art.dialog.open('{:U("cropZoom/index")}',{
						title : '上传裁切图片',
						width : 800,
						height : 500,
						init : function(){
							art.dialog.removeData('crop_zoom_thumb');
						},
						close : function(){
							var value = art.dialog.data('crop_zoom_thumb');// 读取B页面的数据
							if (value !== undefined && value != '') {
								document.getElementById('thumb').value = value;
								$("#thumb_pic_tr").show();
								var append = '?' + new Date().getTime() + 'a' + Math.random();
								$("#thumb_pic").attr("src",value+append);
							}
						},
						lock : true
					});
				});
				
				
				
				$("input[name='select_summary']").click(function(){
					
					
					
					if ($(this).val() == 'custom' && $(this).is(":checked")){
						var shtml = '<tr style="background:#eee;" id="mv_summary">';
						shtml += '<td align="right">自定义摘要内容</td>';
						shtml += '<td align="left"><textarea name="summary" id="summary" style="width:600px;height:140px;"></textarea></td>';
						shtml += '</tr>';
						if ($("#mv_summary").length > 0){
							/*art.dialog.through({
								title : "提示消息",
								content : "请不要重复点击选项。"
							});*/
							return false;
						}else{
							$("#chk_summary").after(shtml);
							//load Editor
							var summary = KindEditor.create("#summary",{
								items:['fontname','fontsize','textcolor','bgcolor','bold','italic','underline','removeformat','justifyleft','justifycenter','justifyright','insertorderedlist','insertunorderedlist','emoticons','link']
							});
						}
					}else{
						$("#mv_summary").remove();
					}
					
				});
				
				
				_checkpress("input[name='title']");
				$("form").submit(function(){
					
					if (_checkform("input[name='title']",'*标题不能为空') == false) return false;
					
					var $_category = $("select[name='cid']");
					if ($_category.val() == 'pselect'){
						if ($_category.hasClass('error_input') == false){
                			$_category.addClass('error_input');
                			$_category.after('<span class="error_info">请选择分类</span>');
                		}
                		return false;
					}
				});
				
				$('select[name="cid"]').change(function(){
					if ($(this).hasClass('error_input')){
		        		$(this).removeClass('error_input');
		        		$(this).next('.error_info').remove();
		        	}
				});
				
            });
            
        </script>
		<title>{:C('ADMIN_TITLE')}</title>
	</head>
	<body>
		<include file="Public:header" />
        
        <div class="layout">
            
            <include file="Public:position" />
            
            <table class="warp" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="sidebar" valign="top">
                        <include file="Public:sidebar" />
                    </td>
                    <td class="contents" valign="top">
                                              
                        <div class="a_table">
					    	<form action="__URL__/insert" method="post">
							<input type="hidden" name="content_attachment" id="content_attachment" value="" />
							<input type="hidden" name="type" value="article" />
							<table cellspacing="1" width="100%" class="form_table">
								<tr>
									<td align="right">文章标题</td>
									<td align="left"><input type="text" name="title" class="input_text w480" /></td>
								</tr>
								<tr>
									<td align="right">分类</td>
									<td align="left">
										<select name="cid" class="input_text" style="width:auto; font-family: Verdana;">
											<option value="pselect">请选择分类</option>
											{$option}
										</select>
									</td>
								</tr>
								<tr>
									<td align="right" class="left_text">语言：</td>
									<td align="left">
										<input type="radio" name="lang" value="zh-cn" checked="checked" /> 中文 &nbsp; 
										<input type="radio" name="lang" value="en-us" /> English
									</td>
								</tr>
								<tr>
									<td align="right">文章属性</td>
									<td align="left">
										<input type="checkbox" name="set_top" value="1" /> 置顶 &nbsp;&nbsp;
										<input type="checkbox" name="recommend" value="1" /> 推荐 &nbsp;&nbsp;
									</td>
								</tr>
								<tr>
									<td align="right">标签</td>
									<td align="left"><input type="text" name="tags" class="input_text w480" /> 多个用空格分割</td>
								</tr>
								<tr>
									<td align="right">状态</td>
									<td align="left">
										<input type="radio" name="status" value="1" checked="checked" /> 显示 &nbsp;&nbsp;
										<input type="radio" name="status" value="0" /> 隐藏 &nbsp;&nbsp;
									</td>
								</tr>
								<tr>
									<td align="right">缩略图</td>
									<td align="left">
										<input type="text" name="thumb" id="thumb" value="" class="input_text w280" style="float:left;margin:0;" align="absmiddle" /> 
										<input type="button" id="newupthumb" class="default_bb" value="上传缩略图" style="float:left;margin-left: 10px;" /><span style="margin-left: 10px;"> *(此功能可自定义大小再次裁切。)</span>
									</td>
								</tr>
								<tr id="thumb_pic_tr" style="display:none;">
									<td align="right">&nbsp;</td>
									<td align="left"><img src="" id="thumb_pic" /></td>
								</tr>
								<tr id="chk_summary">
									<td align="right">摘要设置</td>
									<td align="left">
										<input type="radio" name="select_summary" id="auto_summary" value="auto" checked="checked" /> 自动生成&nbsp; 
										<input type="radio" name="select_summary" id="custom_summary" value="custom" /> 自定义
									</td>
								</tr>
								<tr>
									<td align="right">文章内容</td>
									<td align="left"><textarea name="content" id="content" style="width: 90%; height:260px;"></textarea></td>
								</tr>
								<tr>
									<td align="right"></td>
									<td align="left">
										<div class="submit_default_box">
											<input type="submit" class="submit_default" name="attachment" value="提交表单" />
											<span class="submit_default_icon" id="submit_icon"></span>
										</div>
									</td>
								</tr>
							</table>
							</form>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
        
        <include file="Public:footer" />
	</body>
</html>